from PyQt4 import QtCore

CONFIG = None

def _load_config():
    """Load the config object."""
    global CONFIG # pylint: disable-msg=W0603

    CONFIG = QtCore.QSettings("Andrew Wilkinson", "DjangoDE")

def get_config_value(key, default=None):
    """Get the value from settings that was stored with key."""
    if CONFIG is None:
        _load_config()

    return CONFIG.value(key, default)

def set_config_value(key, value):
    """Save a value into the configuration."""
    if CONFIG is None:
        _load_config()

    CONFIG.setValue(key, value)
